#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.user.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import ${package}.user.bo.User;

public class UserDAO
{
	private EntityManager manager;

	public UserDAO(EntityManager manager)
	{
		this.manager = manager;
	}

	public void store(User user)
	{
		if (user.getUid() != null)
		{
			this.manager.merge(user);
		} else
		{
			this.manager.persist(user);
		}
	}

	@SuppressWarnings("unchecked")
	public List<User> findAll()
	{
		Query qr = this.manager.createNamedQuery(User.FIND_ALL);
		return qr.getResultList();
	}

	public void remove(User user)
	{
		this.manager.remove(user);
	}
}
